package swt;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class SWTLayoutExample{

	public static void main(String[] args) {
		
		Display display = new Display();
		Shell shell = new Shell(display);
		shell.setSize(400, 300);
		shell.setLayout(new RowLayout());
		shell.setText("Layout Demo");

		Composite composite = new Composite(shell, SWT.NONE);
		GridLayout gridLayout = new GridLayout();
		gridLayout.numColumns = 3;
		composite.setLayout(gridLayout);

		Button buttonA = new Button(composite, SWT.NONE);
		buttonA.setText("First Button");
		
		Button buttonB = new Button(composite, SWT.NONE);
		buttonB.setText("Second Button");
				
		Combo comboD = new Combo(composite, SWT.NONE);
		comboD.setItems(new String[] {"Item 1", "Item 2"});
		comboD.select(1);
		
		shell.pack();
		shell.open();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch())
				display.sleep();
		}
		display.dispose();
	}

}



